<template>
  <div>
<table>
  <tr>
    <td>用户名：</td>
  </tr>
  <tr>
    <td><input type="text" v-model="info.name"></td>
  </tr>
  <tr>
    <td>密码：</td>
  </tr>
  <tr>
    <td><input type="password" v-model="info.pwd"></td>
  </tr>
  <tr>
    <td><input type="button" value="登录" @click="Login"></td>
  </tr>
</table>
  </div>
</template>

<script setup lang="ts">

import {ref} from 'vue'

const info = ref({
  name:'',
  pwd:''
})

const Login = () => {
  if(info.value.name==""){
  alert('用户名不能为空')
  return
}
if(info.value.pwd==""){
  alert('密码不能为空')
  return
}
  if(info.value.name=='admin'&&info.value.pwd=='123456'){
    alert('登录成功')
  }else{
    alert('登录失败')
  }
}
</script>
